package dryven.unittest.mocks;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.LinkedList;

import dryven.request.http.AbstractRequest;
import dryven.request.http.Cookie;
import dryven.request.http.Request;
import dryven.request.http.Session;

public class MockRequest extends AbstractRequest {

	private String _localURL;

	public MockRequest(String localURL) {
		super();
		_localURL = localURL;
	}

	@Override
	public String getBodyParam(String name) {
		return null;
	}

	@Override
	public Iterable<String> getBodyParamNames() {
		return new LinkedList<String>();
	}

	@Override
	public int getContentLength() {
		return 0;
	}

	@Override
	public Cookie getCookie(String name) {
		return null;
	}

	@Override
	public Iterable<Cookie> getCookies() {
		return new LinkedList<Cookie>();
	}

	@Override
	public String getHeader(String name) {
		return null;
	}

	@Override
	public Iterable<String> getHeaderNames() {
		return new LinkedList<String>();
	}

	@Override
	public InputStream getInputStream() {
		return new ByteArrayInputStream(new byte[]{});
	}

	@Override
	public String getLocalApplicationURL() {
		return _localURL;
	}

	@Override
	public String getLocalName() {
		return "localhost";
	}

	@Override
	public int getLocalPort() {
		return 80;
	}

	@Override
	public HttpMethod getMethod() {
		return HttpMethod.Get;
	}

	@Override
	public String getRemoteHost() {
		return "somebody.com";
	}

	@Override
	public int getRemotePort() {
		return 94021;
	}

	@Override
	public String getRemoteUser() {
		return null;
	}

	@Override
	public String getRequestURI() {
		return "/dryven/"+_localURL;
	}

	@Override
	public Session getSession() {
		return new Session() {
			
			@Override
			public void setValue(String name, Object value) {
				
			}
			
			@Override
			public void setMaxInactiveInterval(int interval) {
				
			}
			
			@Override
			public void removeValue(String name) {
				
			}
			
			@Override
			public Object getValue(String name) {
				return null;
			}
			
			@Override
			public int getMaxInactiveInterval() {
				return 0;
			}
			
			@Override
			public long getLastAccessedTime() {
				return 0;
			}
		};
	}

	@Override
	public String getURLParam(String name) {
		return null;
	}

	@Override
	public Iterable<String> getURLParamNames() {
		return new LinkedList<String>();
	}

}
